from flask import Flask
from flask_restful import reqparse, Resource, Api


app = Flask(__name__)
api = Api(app)


"""
参数检验错误时返回的错误描述信息
"""
class UserResource(Resource):
    def get(self):
        rp = reqparse.RequestParser()
        rp.add_argument('name', required=True, help='miss name params')
        args = rp.parse_args()
        print(args)
        return {"name":"lisi"}


api.add_resource(UserResource, '/user')


if __name__ == '__main__':
    app.run(debug=True)


